﻿using System;
using fastCSharp;
using fastCSharp.code.cSharp;

namespace diantou.dataModel.path
{
    /// <summary>
    /// 比赛URL
    /// </summary>
    public struct contest
    {
        /// <summary>
        /// 比赛标识
        /// </summary>
        public int Id;
        /// <summary>
        /// 格式化URL
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private webView.hashUrl get(string path)
        {
            return new webView.hashUrl { Path = path, Query = "contestId=" + Id.toString() };
        }
        /// <summary>
        /// 
        /// </summary>
        public string Query
        {
            get { return "contestId=" + Id.toString(); }
        }
        ///// <summary>
        ///// 查询字符串
        ///// </summary>
        //public string AndQuery
        //{
        //    get
        //    {
        //        return "&contestId=" + Id.toString();
        //    }
        //}
        /// <summary>
        /// 主页
        /// </summary>
        public webView.hashUrl Index
        {
            get { return get("/contest/index.html"); }
        }
        /// <summary>
        /// 问题列表
        /// </summary>
        public webView.hashUrl ProblemList
        {
            get { return get("/contest/problemList.html"); }
        }
        /// <summary>
        /// 相关收藏
        /// </summary>
        public webView.hashUrl Favorite
        {
            get { return get("/contest/favorite.html"); }
        }
        /// <summary>
        /// 注册用户列表
        /// </summary>
        public webView.hashUrl JoinUser
        {
            get { return get("/contest/joinUser.html"); }
        }
        /// <summary>
        /// 得分排行
        /// </summary>
        public webView.hashUrl PointRank
        {
            get { return get("/contest/pointRank.html"); }
        }
        /// <summary>
        /// 奖励及说明
        /// </summary>
        public webView.hashUrl Description
        {
            get { return get("/contest/description.html"); }
        }
        /// <summary>
        /// 提交记录
        /// </summary>
        public webView.hashUrl JudgeList
        {
            get { return get("/contest/judgeList.html"); }
        }
        /// <summary>
        /// 外部编辑
        /// </summary>
        public webView.hashUrl ExternalEdit
        {
            get { return get("/contest/edit.html"); }
        }
        /// <summary>
        /// 导出用户信息
        /// </summary>
        public string ExportUser
        {
            get { return "/contest/contestUser/Export?contestId=" + Id.toString(); }
        }
        /// <summary>
        /// 用户在比赛下的提交记录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public webView.hashUrl ContestSubmit(int userId)
        {
            return new webView.hashUrl { Path = "/contest/submitList.html", Query = Query + new diantou.dataModel.path.user { Id = userId }.AndQuery };
        }
        /// <summary>
        /// 比赛列表页
        /// </summary>
        public const string List = "/contest/list.html";
        /// <summary>
        /// 排行榜页面
        /// </summary>
        internal const string Rank = "/contest/rankList.html";
    }
}
